﻿using LL2025.Libs.Queue;

var config = new BusConfig
{
    RabbitMqHost = "124.221.160.244",
    QueueName = "my-queue1",
    Username = "ll",
    Password = "123456",
    NeedRecived = false, // 需要接收消息
};

using var busManager = new BusManager(config);

await busManager.StartAsync();




var message1 = new OrderSubmitted
{
    OrderId = Guid.NewGuid(),
    CustomerNumber = "C12345",
    Timestamp = DateTime.UtcNow
};
while (true)
{
    // 等待用户按下回车键
    ConsoleKeyInfo keyInfo = Console.ReadKey(true);
    if (keyInfo.Key == ConsoleKey.Enter)
    {
        // 检测到回车键，触发消息发布
        await busManager.PublishAsync(message1);
        Console.WriteLine($"消息已发布: OrderId={message1.OrderId}, CustomerNumber={message1.CustomerNumber}, Timestamp={message1.Timestamp}");
    }
}
//  await Task.Delay(10); // 每秒发布一次消息

